package com.dlu.safe_construction.dto;

import com.dlu.safe_construction.model.Area;
import com.dlu.safe_construction.model.Space;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * Created by  lijiaxing on 2022/3/30 16:32
 *
 * @author lijiaxing
 */
@Getter
@Setter
public class AreaInfoDTO extends Area {
    private List<Space> spaces;

    public static AreaInfoDTO fromArea(Area area, List<Space> spaces) {
        AreaInfoDTO areaInfoDTO = new AreaInfoDTO();
        areaInfoDTO.setSpaces(spaces);
        areaInfoDTO.setAreaId(area.getAreaId());
        areaInfoDTO.setSpaceNum(area.getSpaceNum());
        return areaInfoDTO;
    }
}
